/**
 * Created by walkman on 2017/6/23.
 */
(function () {

  angular.module('WfbPlatformApp').controller('DynamicController',
    ['$rootScope', '$scope', '$http', '$compile', 'http', '$q', 'transactionService',
      function ($rootScope, $scope, $http, $compile, http, $q, transactionService) {

        $scope.$on('$viewContentLoaded', function () {
          // initialize core components
        });

        $scope.$on('$includeContentLoaded', function () {

        });

        // 新增参数
        $scope.currentPage = 1;
        $scope.pageSize = 10;
        $scope.total = 0;
        $scope.pointType = 11;
        $scope.contents = {};

        $scope.getActivePoints = function (pageNo,pageSize,pointType) {

          var promise = transactionService.getPoints({
            'pageNo': pageNo,
            'pageSize': pageSize,
            'pointType': pointType
          });
          promise.then(function success(result) {
            // console.log(JSON.stringify(result));
            //成功回调
            $scope.contents = result.data;
            // 分页数
            $scope.total = result.totalCount;
          }, function error(error) {//错误回调
            // console.log(JSON.stringify(error));
          });
        };

        $scope.pageAction = function (message, page, pageSize, total) {

          console.log({
            text: message,
            page: page,
            pageSize: pageSize,
            total: total
          });

          $scope.getActivePoints(page,pageSize,$scope.pointType);
        };

        $scope.getActivePoints($scope.currentPage,$scope.pageSize, $scope.pointType);

      }]);
})();
